package com.bdqn.struts.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class MyTimerInterceptor extends AbstractInterceptor {
    @Override
    public String intercept(ActionInvocation actionInvocation) throws Exception {
        //获取Action执行之前的系统当前时间
        long starTime=System.currentTimeMillis();
        //执行后继的拦截器或者Action
        String result=actionInvocation.invoke();
        long endTime=System.currentTimeMillis()-starTime;
        System.out.println("Action所用时:"+endTime);
        return result;
    }
}
